<template>
  <div class="feedback">
    <div> <van-nav-bar title="意见反馈" left-arrow @click-left="$router.back()" /></div>
    <div class="bbox">
      <div class="box">
        <h4>反馈问题类型:</h4>
        <div class="main">
          <div v-for="(item, index) of list" :key="item.label" class="qw" :class="{ active: isActive === index }"
            @click="changeClass(index)">
            <span v-if="isActive === index">√</span>
            <span>{{ item.label }}</span>
          </div>
        </div>
      </div>
      <div>
        <textarea id="message" style="margin: 20px 0; border: 0; width: 99%; height: 100px;" v-model="message" required></textarea>
      </div>
      <!-- <button type="submit" @click="submitFeedback">提交</button> -->
      <van-button  type="info" size="large" color="#dee1e6"  @click="submitFeedback">提交</van-button>
    </div>
  </div>
</template>

<script>
import { Toast } from 'vant';
export default {
  // el:'.feedback',
  data() {
    return {
      isActive: 0,
      message: '',
      submitted: false,
      list: [
        {
          label: '功能异常',
          flag: false,
        },
        {
          label: '体验问题',
          flag: false,
        },
        {
          label: '功能建议',
          flag: false,
        },
        {
          label: '其他',
          flag: false,
        }
      ]
    }
  },
  methods: {
    changeClass(i) {
      this.isActive = i
    },
    submitFeedback() {
      console.log(this.message)
      this.message = ''
      Toast.success('感谢您的反馈');
    }
  }
}
</script>
<style lang="scss" scoped>
.feedback {
  background-color: #f8f8f8;
  width: 100%;
  height: 100%;
.bbox{
  margin-left: 5%;
  margin-top: 10px;
  width: 90%;
}
  .box {
    display: flex;
    flex-direction: column;

    .main {
      display: flex;
      flex-wrap: wrap;
      margin-top: 10px;

      .qw {
        width: 100px;
        height: 30px;
        border: 1px solid #f0f0f0;
        color: #ccc;
        display: flex;
        justify-content: center;
        align-items: center;
        margin: 3px;
      }

      .active {
        color: #000;
        border: 1px solid #000;
      }
    }
  }
}
</style>